
package com.thon.service.util.impl;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thon.dao.util.HighCharts;
import com.thon.entity.util.IdEntity;
import com.thon.service.util.AbstractDataAnalysis;
import com.thon.service.util.AnalysisResult;
import com.thon.service.util.DateAnalysis;

/**
 * @file DataAnalysis.java
 * @author manpiaoyi
 * @email manpiaoyi@126.com
 * @date 2014-11-8
 * @description 数据分析服务
 */
@Service("DatabaseAnalysisService")
@Transactional
public class DatabaseAnalysisService<T extends IdEntity> extends AbstractDataAnalysis<T>{
	
	private DateAnalysis<T> anlaysis;
	private AnalysisResult<T,HighCharts> result;
	private HighCharts highCharts;
	private List<T> tempDatum;
	
	public DateAnalysis<T> getAnlaysis() {
		return anlaysis;
	}

	public void setAnlaysis(DateAnalysis<T> anlaysis) {
		this.anlaysis = anlaysis;
	}

	public AnalysisResult<T, HighCharts> getResult() {
		return result;
	}

	public void setResult(AnalysisResult<T, HighCharts> result) {
		this.result = result;
	}
	
	
	@Override
	public void analyseData() {

		tempDatum = anlaysis.dataAnalysis(getDatum());
		
	}

	@Override
	public void writeResult() {
		highCharts = null;
		setHighCharts(result.writeAnalysisResult(tempDatum));
		
	}

	public HighCharts getHighCharts() {
		return highCharts;
	}

	public void setHighCharts(HighCharts highCharts) {
		this.highCharts = highCharts;
	}


}